using System.Linq;
using jSLCore.Client.Presentation.BaseControl;
using jSLCore.Client.Utility;

namespace jSLCore.Client.Presentation
{
    public partial class ContentContainerBase : DataControl
    {
        partial void DoAfterLoading()
        {
            var pars = UIHelper.GetCurrentWebPageParameters();

            if (pars.Keys != null)
            {
                string key = pars.Keys.FirstOrDefault();

                if (key != null)
                {
                    GotoIndexedPage(key.ToUpper(), pars[key].ToUpper());
                }
            }
        }


        /// <summary>
        /// Override this method to catch any query parameters provided by the browser
        /// </summary>
        /// <param name="key">The key of the query parameter</param>
        /// <param name="value">The value of the query parameter</param>
        public virtual void GotoIndexedPage(string key, string value)
        {
        }
    }
}